function liuUpdaerUser() {
    var $userform = $("#userupdate").find("form");
    var params = $userform.serialize();
    var pwd = $userform.find("[name= pwd]").val();
    var newpwd = $userform.find("[name= newpwd]").val();
    var okpwd = $userform.find("[name=okpwd]").val();
    var loginName = $("#loginName").html();

    if(pwd==null || pwd == ""){
        $userform.find("#pwdred").html("请输入原密码");
        return
    }else{
        $userform.find("#pwdred").html("")
        if(newpwd == null || newpwd == ""){
            $userform.find("#newpwdred").html("请输入新密码");
            return;
        }else{
            $userform.find("#newpwdred").html("");
            if(okpwd == null || okpwd == ""){
                $userform.find("#okpwdred").html("请确认新密码");
            }else{
                $userform.find("#okpwdred").html("");
                if(newpwd != okpwd ){
                    $userform.find("#okpwdred").html("密码两次输入不一致");
                }else{
                        $.post(ctx+"/sys/user/compliPwd","password="+pwd,function(data){
                        if(data=="错误"){
                            $userform.find("#pwdred").html("原密码输入错误！");
                        }else{
                            $.post(ctx+"/sys/user/setPwdLiu",{"loginName":loginName,"password":okpwd},function (data) {
                                parent.parent.swal({
                                    title:"信息提示!",
                                    text:data,
                                    type:"success",
                                    allowOutsideClick:false
                                }).then(function (isConfirm) {
                                    if (isConfirm == true){
                                        $.post(ctx+"/sys/user/closeSession",null,function(){
                                            setTimeout(2000,tiao());
                                        })
                                    }
                                })
                                $(document).keyup(function(event){
                                    switch(event.keyCode) {
                                        case 27:{
                                            $.post(ctx + "/sys/user/closeSession", null, function () {
                                                setTimeout(2000, tiao());
                                            })
                                        }
                                        case 116:{
                                            $.ajax({
                                                url:ctx + "/sys/user/closeSession",
                                                data:null,
                                                async:false,
                                                success:function(){
                                                    setTimeout(2000, tiao());
                                                }
                                            })
                                        }
                                    }
                                });
                            });
                        }
                    });
                }
            }
        }
    }
}
function tiao() {
    parent.parent.location.href=ctx+'/login.jsp';
}